﻿using Infragistics.Controls.Interactions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace VNet.VisiSuite.Controls
{
    /// <summary>
    /// Interaction logic for SaveChangesDialog.xaml
    /// </summary>
    public partial class SaveChangesDialog : Window
    {
        private SaveChangesDialogResult _result = SaveChangesDialogResult.Resume;

        public SaveChangesDialog()
        {
            InitializeComponent();
        }

        public SaveChangesDialog(string message, string title)
            : this()
        {
            Title = title;
            _messageTbk.Text = message;
        }

        public new SaveChangesDialogResult Show()
        {
            base.ShowDialog();
            return _result;
        }

        public new SaveChangesDialogResult ShowDialog()
        {
            return this.Show();
        }

        private void DiscardBtn_Click(object sender, RoutedEventArgs e)
        {
            _result = SaveChangesDialogResult.Discard;
            base.Close();
        }

        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            _result = SaveChangesDialogResult.Save;
            base.Close();
        }

        private void ResumeBtn_Click(object sender, RoutedEventArgs e)
        {
            _result = SaveChangesDialogResult.Resume;
            base.Close();
        }
    }

    public enum SaveChangesDialogResult
    {
        Discard,
        Save,
        Resume,
    }
}
